package push.tools.service.api;


import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import push.tools.service.entity.push.PushTaskBean;
import push.tools.service.framework.PostController;
import push.tools.service.service.task.TaskLogService;

import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping(value = "/main", produces = {"application/json;charset=UTF-8"})
public class MAIN_000_000_002 extends PostController {

    private static final Logger logger = LoggerFactory.getLogger(MAIN_000_000_002.class);

    @Autowired
    public TaskLogService taskLogService;

    //创建推送任务接口
    @PostMapping(value = "/000_000_002")
    public String doPost(HttpServletRequest request) {
        return handleRequest(request);
    }

    @Override
    protected String postRequest(HashMap<String, String> requestParam) {
        String requestBody = requestParam.get("requestBody");
        //封装响应体
        List<PushTaskBean> pushTaskBeans = taskLogService.queryLog();
        return generateSucceed(pushTaskBeans);
    }
}
